package com.sjsu.aws.primitve;

/**
 * 
 * @author Deepali Pawar
 *
 */
import org.apache.log4j.Logger;
import com.sjsu.aws.db.TableOperationImpl;
import com.sjsu.aws.db.TableRow;

public class PrimitiveServiceImpl implements PrimitiveService {
	
	private final static Logger	LOG	= Logger.getLogger(PrimitiveServiceImpl.class);
	
	private TableOperationImpl	        tableOperationImpl;
	private TableRow	                tableRow;
	
	public PrimitiveServiceImpl() throws Exception {
		this.tableOperationImpl = new TableOperationImpl();
		this.tableRow = new TableRow();
	}
	
	@Override
	public void createService(Primitive pm) throws Exception {
		LOG.info("Creating table for " + pm.getServiceName() + " on Amazon");
		tableOperationImpl.createTable(pm.getServiceName(), pm.getKeyName(),
		        pm.getKeyType());
	}
	
	@Override
	public void deleteService(Primitive pm) throws Exception {
		LOG.info("Deleting table for " + pm.getServiceName() + " on Amazon");
		tableOperationImpl.deleteTable(pm.getServiceName());
	}
}
